<html>

<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> 
  <link rel="stylesheet" title="Default" href="http://acm.math.spbu.ru/~sk1/colorer/my.css">

  <script src="http://acm.math.spbu.ru/~sk1/colorer/highlight.js"></script>
  <script src="http://acm.math.spbu.ru/~sk1/colorer/cpp.js"></script>
  <script>hljs.initHighlightingOnLoad();</script>
</head>

<body>

<pre><code>
/**
 * Author: Sergey Kopeliovich (Burunduk30@gmail.com5
 * Date: 2013.10.18
 */

#include &lt;cstdio&gt;
#include &lt;cassert&gt;
#include &lt;algorithm&gt;

using namespace std;

#define forn(i, n) for (int i = 0; i &lt; (int)(n); i++)

const int N = 200;

const double r1 = 0.58, R1 = r1 * r1;
const double r2 = 1.31, R2 = r2 * r2;
const double eps = 1e-9;

int n, m, k1, k2, cx[N], cy[N];
double ans, r[N];
int p[N];

inline double sqr( double x )
{
  return x * x;
}

inline double dx( double l, double r, double x )
{
  return x &lt; l ? l - x : (x &gt; r ? x - r : 0.0);
}

inline double dist( double lx, double ly, double rx, double ry, double x, double y )
{
  return sqr(dx(lx, rx, x)) + sqr(dx(ly, ry, y));
}

inline double dist( double x1, double y1, double x2, double y2 )
{
  return sqr(x1 - x2) + sqr(y1 - y2);
}
 
void go( double lx, double ly, double rx, double ry, int pn, int *p )
{
  double area = (rx - lx) * (ry - ly);
  if (area &lt; 1e-5)
  {
    ans += area * 0.5;
    return;
  }

  double mx = (lx + rx) / 2;
  double my = (ly + ry) / 2;
  int empty = 1;
  int qn = 0, q[N];
  forn(_i, pn)
  {
    int i = p[_i];
    if (dist(lx, ly, cx[i], cy[i]) &lt; r[i] + eps &&
        dist(rx, ly, cx[i], cy[i]) &lt; r[i] + eps &&
        dist(lx, ry, cx[i], cy[i]) &lt; r[i] + eps &&
        dist(rx, ry, cx[i], cy[i]) &lt; r[i] + eps)
      return; // inside
    if (dist(lx, ly, rx, ry, cx[i], cy[i]) + eps &lt; r[i])
      empty = 0, q[qn++] = i;
  }
  if (empty)
  {
    ans += area;
    return;
  }
  go(mx, my, rx, ry, qn, q);
  go(lx, my, mx, ry, qn, q);
  go(mx, ly, rx, my, qn, q);
  go(lx, ly, mx, my, qn, q);
}

int main()
{
  int tn = 0;
  while (scanf("%d%d%d%d", &n, &m, &k1, &k2) == 4 && (n || m || k1 || k2))
  {
    fprintf(stderr, "[%d]", ++tn);
    forn(i, k1 + k2)
      scanf("%d%d", &cx[i], &cy[i]), r[i] = i &lt; k1 ? R1 : R2, p[i] = i;

    ans = 0;
    go(0, 0, n, m, k1 + k2, p);
    printf("%.2f\n", ans);
  }
  return 0;
}

</code></pre>

</body>
</html>

<font style="visibility:hidden">
